using System.ComponentModel.DataAnnotations;

namespace DaoHang.Models
{
    /// <summary>
    /// 系统日志模型
    /// </summary>
    public class SystemLog
    {
        /// <summary>
        /// 日志ID
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// 日志级别
        /// </summary>
        [Required]
        [MaxLength(20)]
        public string Level { get; set; } = string.Empty;

        /// <summary>
        /// 日志分类
        /// </summary>
        [Required]
        [MaxLength(50)]
        public string Category { get; set; } = string.Empty;

        /// <summary>
        /// 日志消息
        /// </summary>
        [Required]
        public string Message { get; set; } = string.Empty;

        /// <summary>
        /// 异常详情
        /// </summary>
        public string? Exception { get; set; }

        /// <summary>
        /// 用户ID
        /// </summary>
        [MaxLength(100)]
        public string? UserId { get; set; }

        /// <summary>
        /// IP地址
        /// </summary>
        [MaxLength(45)]
        public string? IpAddress { get; set; }

        /// <summary>
        /// 用户代理
        /// </summary>
        [MaxLength(500)]
        public string? UserAgent { get; set; }

        /// <summary>
        /// 请求路径
        /// </summary>
        [MaxLength(500)]
        public string? RequestPath { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;

        /// <summary>
        /// 附加数据（JSON格式）
        /// </summary>
        public string? AdditionalData { get; set; }
    }

    /// <summary>
    /// 日志级别枚举
    /// </summary>
    public static class LogLevel
    {
        public const string Info = "Info";
        public const string Warning = "Warning";
        public const string Error = "Error";
        public const string Debug = "Debug";
        public const string Trace = "Trace";
    }

    /// <summary>
    /// 日志分类枚举
    /// </summary>
    public static class LogCategory
    {
        public const string General = "General";
        public const string Authentication = "Authentication";
        public const string Database = "Database";
        public const string WebsiteManagement = "WebsiteManagement";
        public const string CategoryManagement = "CategoryManagement";
        public const string UserManagement = "UserManagement";
        public const string SystemConfiguration = "SystemConfiguration";
        public const string Performance = "Performance";
        public const string Security = "Security";
        public const string API = "API";
    }
} 